package com.purchase.rest;

import com.purchase.service.ApplyService;
import com.purchase.util.RequestForm;
import com.purchase.util.ResponseForm;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/apply")
public class ApplyController {

    @Autowired
    ApplyService applyService;

    /**
     * 获取列表
     *
     * @param param
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/getList", method = RequestMethod.POST)
    public ResponseForm getList(@RequestBody RequestForm param) {
        return applyService.getList(param);
    }

    /**
     * 添加信息
     *
     * @param param
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/add", method = RequestMethod.POST)
    public ResponseForm add(@RequestBody RequestForm param) {
        return applyService.add(param);
    }

    /**
     * 修改信息
     *
     * @param param
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/edit", method = RequestMethod.POST)
    public ResponseForm edit(@RequestBody RequestForm param) {
        return applyService.edit(param);
    }


    /**
     * 根据ID获取信息
     *
     * @param param
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/getById", method = RequestMethod.POST)
    public ResponseForm getById(@RequestBody RequestForm param) {
        return applyService.getById(param);
    }

}
